﻿using EntityFrameworkLayer.Entities;
using EntityFrameworkLayer.Service;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Data;


namespace DemoEntityFramework
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private MaterialService materialService;

        public MainWindow()
        {
            InitializeComponent();
            materialService = new MaterialService();
        }
                
        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            /*DataSet myDS = new DataSet();
            DataTable table = materialService.GetAll();            
            myDS.Tables.Add(table);                        
            myDS.WriteXml("D:\\freelancer\\project\\DemoExport\\DemoExport\\Report\\Material.xml");*/
            ReportDocument reportDocument = new ReportDocument();
            string path = "D:\\freelancer\\project\\DemoExport\\DemoExport\\Report\\Material.rpt";
            reportDocument.Load(path);            
            crv.ViewerCore.ReportSource = reportDocument;
            MessageBox.Show("Export Successful");
        }
    }
}